<%@ page language="java" contentType="text/html; charset=UTF-8" import="java.util.*"  pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
  <head>
   	<title>凯盛项目管理系统</title>
	<link rel="stylesheet" href="css/bootstrap.min.css" />
	<link rel="stylesheet" href="kind/themes/default/default.css" />
	<link rel="stylesheet" href="kind/plugins/code/prettify.css" />
  </head>
  
  <body>
    <%@ include file = "top.jsp" %>
    <div class="container" style="margin-top:80px">
		<div class="row">
			<div class="span9">
				<form action="goal.jspx?m=addGoal" id="myform" method = "post" class="form-horizontal">
					<fieldset>
						<legend>添加一个新目标</legend>
						<div class="control-group">
							<label for="input01" class="control-label">目标名称</label>
							<div class="controls">
								<input type="text" class="span5" id="name" name="name"style="height:28px"id="input01" />
								<span id="name-msg" style="color:red"></span><br/>
								<p class="help-block">In addition to  text, any HTML5 text-based input appears like so.</p>
							</div>
						</div>
						<div class="control-group">
							<label for="input01" class="control-label">目标描述</label>
							<div class="controls">

							

								<textarea cols="30" rows="15" name="cont" class="span9"></textarea>

							</div>
						</div>
						<div class="form-actions">
							<button type ="submit" id="btnSubmit" class="btn btn-primary">保存</button>							
							<a class="btn" href="goal.jspx">返回</a>
						</div>
					</fieldset>
				</form>
			</div>
		</div>
	</div>
	<script charset="utf-8" src="kind/kindeditor.js"></script>
	<script charset="utf-8" src="kind/lang/zh_CN.js"></script>
	<script charset="utf-8" src=".kind/plugins/code/prettify.js"></script>
	<script>
		
		
		
	
		function validateName() {
			var name = document.getElementById("name").value;
			if(name.trim().length == 0 ) {
				return false;
			}
			return true;
		}
		document.getElementById("name").onblur = function () {
			var result = validateName();
			if(result) {
				document.getElementById("name-msg").innerHTML = "√";
			}
			if(!result) {
				document.getElementById("name-msg").innerHTML = "×目标名不能为空";
			}
		};
		
		document.getElementById("name").onkeyup = function(){
			document.getElementById("name-msg").innerHTML = "";
		};
		
		document.getElementById("btnSubmit").onclick = function (){	
			//通过button按钮来提及表单
			if(validateName()) {
				document.getElementById("myform").submit();
			} else {
			//若果上述条件不成立则不能提交表单button
				document.getElementById("myform").button();
			}		
		};
		
	</script>
  </body>
</html>

